/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.jr2tecnologia.model.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ronildo
 */
@Entity
@Table(name = "sms_received")
@NamedQueries({
    @NamedQuery(name = "SmsReceived.findAll", query = "SELECT s FROM SmsReceived s"),
    @NamedQuery(name = "SmsReceived.findByPkSmsReceived", query = "SELECT s FROM SmsReceived s WHERE s.pkSmsReceived = :pkSmsReceived"),
    @NamedQuery(name = "SmsReceived.findBySender", query = "SELECT s FROM SmsReceived s WHERE s.sender = :sender"),
    @NamedQuery(name = "SmsReceived.findByMessage", query = "SELECT s FROM SmsReceived s WHERE s.message = :message"),
    @NamedQuery(name = "SmsReceived.findByDatetimeReceived", query = "SELECT s FROM SmsReceived s WHERE s.datetimeReceived = :datetimeReceived"),
    @NamedQuery(name = "SmsReceived.findByNowSmsId", query = "SELECT s FROM SmsReceived s WHERE s.nowSmsId = :nowSmsId"),
    @NamedQuery(name = "SmsReceived.findByDatetimeReceivedInModem", query = "SELECT s FROM SmsReceived s WHERE s.datetimeReceivedInModem = :datetimeReceivedInModem")})
public class SmsReceived implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "pk_sms_received")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seq_sms_received")
    @SequenceGenerator(name="seq_sms_received", sequenceName="seq_sms_received", allocationSize=1)
    private Long pkSmsReceived;
    @Basic(optional = false)
    @Column(name = "sender")
    private String sender;
    @Basic(optional = false)
    @Column(name = "message")
    private String message;
    @Basic(optional = false)
    @Column(name = "datetime_received")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetimeReceived;
    @Basic(optional = false)
    @Column(name = "now_sms_id")
    private String nowSmsId;
    @Basic(optional = false)
    @Column(name = "datetime_received_in_modem")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetimeReceivedInModem;
    @JoinColumn(name = "fk_modem", referencedColumnName = "pk_modem")
    @ManyToOne(optional = false)
    private Modem modem;
    @JoinColumn(name = "fk_login", referencedColumnName = "pk_login")
    @ManyToOne(optional = false)
    private Login login;
    @JoinColumn(name = "fk_key_response", referencedColumnName = "pk_key_response")
    @ManyToOne
    private KeyResponse keyResponse;

    public SmsReceived() {
    }

    public SmsReceived(Long pkSmsReceived) {
        this.pkSmsReceived = pkSmsReceived;
    }

    public SmsReceived(Login login){
        this.login = login;
    }

    public SmsReceived(Long pkSmsReceived, String sender, String message, Date datetimeReceived, String nowSmsId, Date datetimeReceivedInModem) {
        this.pkSmsReceived = pkSmsReceived;
        this.sender = sender;
        this.message = message;
        this.datetimeReceived = datetimeReceived;
        this.nowSmsId = nowSmsId;
        this.datetimeReceivedInModem = datetimeReceivedInModem;
    }

    public Long getPkSmsReceived() {
        return pkSmsReceived;
    }

    public void setPkSmsReceived(Long pkSmsReceived) {
        this.pkSmsReceived = pkSmsReceived;
    }

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Date getDatetimeReceived() {
        return datetimeReceived;
    }

    public void setDatetimeReceived(Date datetimeReceived) {
        this.datetimeReceived = datetimeReceived;
    }

    public String getNowSmsId() {
        return nowSmsId;
    }

    public void setNowSmsId(String nowSmsId) {
        this.nowSmsId = nowSmsId;
    }

    public Date getDatetimeReceivedInModem() {
        return datetimeReceivedInModem;
    }

    public void setDatetimeReceivedInModem(Date datetimeReceivedInModem) {
        this.datetimeReceivedInModem = datetimeReceivedInModem;
    }

    public Modem getModem() {
        return modem;
    }

    public void setModem(Modem modem) {
        this.modem = modem;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

    public KeyResponse getKeyResponse() {
        return keyResponse;
    }

    public void setKeyResponse(KeyResponse keyResponse) {
        this.keyResponse = keyResponse;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pkSmsReceived != null ? pkSmsReceived.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SmsReceived)) {
            return false;
        }
        SmsReceived other = (SmsReceived) object;
        if ((this.pkSmsReceived == null && other.pkSmsReceived != null) || (this.pkSmsReceived != null && !this.pkSmsReceived.equals(other.pkSmsReceived))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.jr2tecnologia.model.entity.SmsReceived[pkSmsReceived=" + pkSmsReceived + "]";
    }

}
